
import React from "react";

//非受控组件
export default class Login extends React.Component {
	state = {
       
    }
	render() {
		return (
			<div>
				<form onSubmit={this.handlerSubmit}>
                    用户名<input ref={c=>this.username = c}/>
                    密码<input  ref={c=>this.password = c}/>
                    <button>登录</button>
                </form>
			</div>
		)
	}
    handlerSubmit = (event)=>{
        event.preventDefault()
        const {username,password} = this
        alert(`用户名：${username.value},密码：${password.value}`)
    }
}